<?xml version="1.0" encoding="UTF-8"?>

<ui:composition xmlns="http://www.w3.org/1999/xhtml"
xmlns:f="http://java.sun.com/jsf/core"
     xmlns:h="http://java.sun.com/jsf/html"
     xmlns:ui="http://java.sun.com/jsf/facelets"
     xmlns:p="http://primefaces.org/ui"
     template="../../../Template.xhtml"
>
<ui:define name="title">Add private Shippers</ui:define>

<ui:define name="body"  >
<script>
	function ChangeVisibility()
	{
		
		
		 if(document.getElementById('j_idt92:UserType_input').value=="Temporary")
			 {
			 
			 document.getElementById('j_idt92:lobjet').style.display = 'none';
			 }
		 else
			 {
			 document.getElementById('j_idt92:lobjet').style.display = 'block';
			 }
			 
	}
	$(document).ready(function() {
		ChangeVisibility()
		});

</script>
<div onload="ChangeVisibility()">
<h:form>
<p:inputText value="#{clientMB.id}"/>
	<p:panelGrid columns="2">
<h2>Add New professional  Shippers</h2>
<p:commandButton value="Back" action="ManageProShippers.xhtml" />
</p:panelGrid>
</h:form>
<h:form>

</h:form>
<br/><br/><br/><br/>
<h:form>

<p:messages id="messages" showDetail="true" autoUpdate="true" closable="true" />

<p:panelGrid columns="1">
<p:outputLabel value="Company Details:" />

	<p:panelGrid columns="3">
	<p:outputLabel  value="Company Name :" />
		<p:inputText id="cm" value="#{clientMB.client.nom_Societe}" required="true"   requiredMessage="Company Name is required"/>
		<p:message for="cm"/>
	
	<p:outputLabel  value="Company Website:" />
		<p:inputTextarea id="CD" value="#{clientMB.client.web_Site}" required="true"   requiredMessage="Company Website is required"/>
		<p:message for="CD"/>
	
	
	
          
          <p:outputLabel value="Industry Type :"/>
		  <p:selectOneMenu id="Industry" value="#{clientMB.idIndustry}" style="width:150px" required="true"   requiredMessage="Industry Type is required"  >
                <f:selectItem itemLabel="Select Industry" itemValue="" noSelectionOption="true" />
                <f:selectItems value="#{clientMB.listeIndustrie()}" var="a" itemValue="#{a.idIndustrie}" itemLabel="#{a.intitule}" />
            </p:selectOneMenu>
      <p:message for="Industry"/>
      
      
            
              
	<p:outputLabel value="Select Country :" />
	   <p:selectOneMenu id="countryc" value="#{clientMB.idCcm}" style="width:150px"  required="true" requiredMessage="please select a country" >
                <p:ajax listener="#{clientMB.onCountryChange(1)}" update="Statec" />
                <f:selectItem itemLabel="Select Country" itemValue="" noSelectionOption="true" />
                <f:selectItems value="#{clientMB.listPays}" var="a" itemValue="#{a.idPays}" itemLabel="#{a.intitule}" />
            </p:selectOneMenu>
            <p:message for="countryc"/>
	
	  <p:outputLabel value="Select State :" />
	  <p:selectOneMenu id="Statec" value="#{clientMB.idScm}" style="width:150px"  required="true" requiredMessage="please select a state">
               <p:ajax listener="#{clientMB.onStateChange(1)}" update="cityc" />
                 <f:selectItem itemLabel="Select State" itemValue="" noSelectionOption="true" />
                <f:selectItems value="#{clientMB.listeEtatcm}"  var="s" itemValue="#{s.idEtat}"  itemLabel="#{s.intitule}"/>
            </p:selectOneMenu>
            <p:message for="Statec"/>
            
		<p:outputLabel value="Select City :"/>
		  <p:selectOneMenu id="cityc" value="#{clientMB.idCicm}" style="width:150px"  required="true" requiredMessage="City is required" >
                <f:selectItem itemLabel="Select city" itemValue="" noSelectionOption="true" />
                <f:selectItems value="#{clientMB.listeVillecm}" var="a" itemValue="#{a.idVille}" itemLabel="#{a.intitule}" />
            </p:selectOneMenu>
               <p:message for="cityc"/>
	
	  <p:outputLabel  value="Zipcode :" />
	  <p:inputText id="zipcodeC" value="#{clientMB.client.codePost_Societe}" required="true"   requiredMessage="zip code is required"/>
	  <p:message for="zipcodeC"/>
	
	 <p:outputLabel  value="Street :" />
		<p:inputText id="StreetC" value="#{clientMB.client.rue_Societe}" required="true"   requiredMessage="street is required"/>
		<p:message for="StreetC"/>
		
		
		
		<p:outputLabel  value="Telephone :" />
		<p:inputText id="TelephoneC" value="#{clientMB.client.telephone_societe}" required="true"   requiredMessage="Telephone is required"/>
		<p:message for="TelephoneC"/>
		
		
		<p:outputLabel  value="Fax :" />
		<p:inputText id="fax" value="#{clientMB.client.fax}" required="true"   requiredMessage="Mobile is required"/>
		<p:message for="fax"/>
	
	
	<p:outputLabel  value="Organization No. :" />
		<p:inputText id="ORG" value="#{clientMB.client.organization_Number}" required="true"   requiredMessage="Mobile is required"/>
	<p:message for="ORG"/>


		<p:outputLabel  value="GLN (Global Location Number) GIS:" />
				<p:inputText id="GLN" value="#{clientMB.listgln[0]}" />
		<p:message for="GLN"/>
		

		<p:outputLabel  value="Insurance Company :" />
		<p:inputText id="AS" value="#{clientMB.client.assurance_Societe}" required="true"   requiredMessage="Mobile is required"/>
		<p:message for="AS"/>
		
		
		
		<p:outputLabel  value="Insurance Address:" />
		<p:inputText id="IA" value="#{clientMB.client.assurance_Adresse}" required="true"   requiredMessage="Mobile is required"/>
		<p:message for="IA"/>
		
		
		<p:outputLabel  value="Insurance Policy Number:" />
		<p:inputText id="IPN" value="#{clientMB.client.assurance_Policy_Number}" required="true"   requiredMessage="Mobile is required"/>
		<p:message for="IPN"/>
		
		<p:outputLabel  value="Insurance Amount:" />
		<p:inputText id="IAM" value="#{clientMB.client.assurance_Policy_Number}" required="true"   requiredMessage="Mobile is required"/>
		<p:message for="IAM"/>
		
		
		<p:outputLabel  value="Insurance Contact Person:" />
		<p:inputText id="ICP" value="#{clientMB.client.assurance_Contact_phone}" required="true"   requiredMessage="Mobile is required"/>
		<p:message for="ICP"/>
		
		<p:outputLabel  value="Insurance Expiry Date:" />
		<p:calendar id="IED" value="#{clientMB.client.asssurance_Expiration}" required="true"   requiredMessage="Mobile is required"/>
		<p:message for="IED"/>
		</p:panelGrid>
		<p:outputLabel value="Postal Address:"   />
		
		<p:panelGrid columns="3">
		 <p:outputLabel value="Select Country :" />
	   <p:selectOneMenu id="countryp" value="#{clientMB.idCp}" style="width:150px"  required="true" requiredMessage="please select a country" >
                <p:ajax listener="#{clientMB.onCountryChange(2)}" update="Statep" />
                <f:selectItem itemLabel="Select Country" itemValue="" noSelectionOption="true" />
                <f:selectItems value="#{clientMB.listPays}" var="a" itemValue="#{a.idPays}" itemLabel="#{a.intitule}" />
            </p:selectOneMenu>
            <p:message for="countryp"/>
	  <p:outputLabel value="Select State :" />
	  <p:selectOneMenu id="Statep" value="#{clientMB.idSp}" style="width:150px"  required="true" requiredMessage="please select a state">
               <p:ajax listener="#{clientMB.onStateChange(2)}" update="cityp" />
                 <f:selectItem itemLabel="Select State" itemValue="" noSelectionOption="true" />
                <f:selectItems value="#{clientMB.listeEtatp}"  var="s" itemValue="#{s.idEtat}"  itemLabel="#{s.intitule}"/>
            </p:selectOneMenu>
            <p:message for="Statep"/>
            
		<p:outputLabel value="Select City :"/>
		  <p:selectOneMenu id="cityp" value="#{clientMB.idCip}" style="width:150px"  required="true" requiredMessage="City is required" >
                <f:selectItem itemLabel="Select city" itemValue="" noSelectionOption="true" />
                <f:selectItems value="#{clientMB.listeVillep}" var="a" itemValue="#{a.idVille}" itemLabel="#{a.intitule}" />
            </p:selectOneMenu>
               <p:message for="cityp"/>
		
		 <p:outputLabel  value="Zipcode :" />
	  <p:inputText id="zipcodeP" value="#{clientMB.client.codePost_Postal}" required="true"   requiredMessage="zip code is required"/>
	  <p:message for="zipcodeP"/>
	
	 <p:outputLabel  value="Street :" />
		<p:inputText id="StreetP" value="#{clientMB.client.rue_Postal}" required="true"   requiredMessage="street is required"/>
		<p:message for="StreetP"/>
		</p:panelGrid>
		
		<p:outputLabel value="User:" />
		<p:panelGrid columns="3" >
		 <p:outputLabel value="User Type :" />
	   <p:selectOneMenu  id="UserType" value="#{clientMB.userType}" onchange="ChangeVisibility()" style="width:150px"  required="true" requiredMessage="service type is required" >
         	   
         	   <f:selectItem itemLabel="-Select-" itemValue="" noSelectionOption="true" />
               <f:selectItem itemLabel="Temporary User" itemValue="Temporary" />
               <f:selectItem itemLabel="Permanent User" itemValue="Permanent" />
               
        </p:selectOneMenu>
            <p:message for="UserType"/>
        <p:panelGrid columns="2" id="lobjet" style="display:none;" >
        <p:outputLabel id="f" value="Periods :" />
        <p:selectOneMenu value="#{clientMB.idAbonnement}">
        	<f:selectItems value="#{clientMB.listeAbonnement()}" var="a" itemLabel="#{a.nbrPeriode}#{a.periode}" itemValue="#{a.idStaretegie}" />
        </p:selectOneMenu>
		  <p:outputLabel for="popup" value="begin date:" />
        <p:calendar id="popup" value="#{clientMB.dateDebAbn}" />
		</p:panelGrid>
         </p:panelGrid>
    
	
		<p:outputLabel value="Contanct Person Info:" />
		<p:panelGrid columns="3">		
	
	
		<p:outputLabel  value="Position :" />
		<p:inputText id="position" value="#{clientMB.client.position}" required="true"   requiredMessage="last name is required"/>
		<p:message for="position"/>
		
	<p:outputLabel  value="Last Name :" />
		<p:inputText id="LName" value="#{clientMB.client.nom}" required="true"   requiredMessage="last name is required"/>
		<p:message for="LName"/>
		
		<p:outputLabel  value="First Name :" />
		<p:inputText id="fName" value="#{clientMB.client.prenom}" required="true"   requiredMessage="forst name is required"/>
		<p:message for="fName"/>
		
		
	  <p:outputLabel value="Select Country :" />
	   <p:selectOneMenu id="countryu" value="#{clientMB.idC}" style="width:150px"  required="true" requiredMessage="please select a country" >
                <p:ajax listener="#{clientMB.onCountryChange(0)}" update="Stateu" />
                <f:selectItem itemLabel="Select Country" itemValue="" noSelectionOption="true" />
                <f:selectItems value="#{clientMB.listPays}" var="a" itemValue="#{a.idPays}" itemLabel="#{a.intitule}" />
            </p:selectOneMenu>
            <p:message for="countryu"/>
	
	  <p:outputLabel value="Select State :" />
	  <p:selectOneMenu id="Stateu" value="#{clientMB.idS}" style="width:150px"  required="true" requiredMessage="please select a state">
               <p:ajax listener="#{clientMB.onStateChange(0)}" update="cityu" />
                 <f:selectItem itemLabel="Select State" itemValue="" noSelectionOption="true" />
                <f:selectItems value="#{clientMB.listeEtat}"  var="s" itemValue="#{s.idEtat}"  itemLabel="#{s.intitule}"/>
            </p:selectOneMenu>
            <p:message for="Stateu"/>
            
            
		<p:outputLabel value="Select City :"/>
		  <p:selectOneMenu id="cityu" value="#{clientMB.idCi}" style="width:150px"  required="true" requiredMessage="City is required" >
                <f:selectItem itemLabel="Select city" itemValue="" noSelectionOption="true" />
                <f:selectItems value="#{clientMB.listeVille}" var="a" itemValue="#{a.idVille}" itemLabel="#{a.intitule}" />
            </p:selectOneMenu>
               <p:message for="cityu"/>
               
               
            <p:outputLabel  value="Zipcode :" />
		<p:inputText id="zipcode" value="#{clientMB.client.codePost_usr}" required="true"   requiredMessage="zip code is required"/>
		<p:message for="zipcode"/>
		
		
		 <p:outputLabel  value="Street :" />
		<p:inputText id="Street" value="#{clientMB.client.rue_usr}" required="true"   requiredMessage="street is required"/>
		<p:message for="Street"/>
		
		
		
		<p:outputLabel  value="Telephone :" />
		<p:inputText id="Telephone" value="#{clientMB.client.telephone_usr}" required="true"   requiredMessage="Telephone is required"/>
		<p:message for="Telephone"/>
		
		
		<p:outputLabel  value="Mobile :" />
		<p:inputText id="Mobile" value="#{clientMB.client.mobile_usr}" required="true"   requiredMessage="Mobile is required"/>
		<p:message for="Mobile"/>
		<p:outputLabel  value="Email :" />
		<p:inputText id="Email" value="#{clientMB.client.email}" required="true"   requiredMessage="Email is required"/>
		<p:message for="Email"/>
		<p:outputLabel  value="Password :" />
		<p:inputText id="Password" value="#{clientMB.client.password}" required="true"   requiredMessage="Password is required"/>
		<p:message for="Password"/>
		
		
		<p:outputLabel  value="Username :" />
		<p:inputText id="Username" value="#{clientMB.client.username}" required="true"   requiredMessage="Username is required"/>
		<p:message for="Username"/>
		
		<p:outputLabel  value="Client Identification Number(CID) :" />
		<p:inputText id="clid" value="#{clientMB.client.CID}" readonly="true"/>
		<p:message for="clid"/>
		
		<p:outputLabel value="Status :" />
		<p:selectOneMenu value="#{clientMB.client.statut}" >
			<f:selectItem  itemValue="true" itemLabel="Active"  />
			<f:selectItem  itemValue="false" itemLabel="Inactive"  />
		</p:selectOneMenu><br/>
		<p:commandButton ajax="false" action="#{clientMB.Modifier()}" value="Update" ></p:commandButton>
		
	</p:panelGrid>
</p:panelGrid>

</h:form>
</div>
</ui:define>
</ui:composition>